# 使用官方 .NET 8.0 运行时镜像
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 5000
EXPOSE 5001

# 使用 .NET 8.0 SDK 镜像来构建
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Mpurl.csproj", "."]
RUN dotnet restore "Mpurl.csproj"
COPY . .
RUN dotnet build "Mpurl.csproj" -c Release -o /app/build

# 发布项目
FROM build AS publish
RUN dotnet publish "Mpurl.csproj" -c Release -o /app/publish

# 最终运行时镜像
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Mpurl.dll"]